package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class FieldDefinition {

    private Identifier fieldName;
    private DataType dataType;
    private ReferenceScopeCheck referenceScopeCheck;

    public FieldDefinition(Identifier fieldName, DataType dataType, ReferenceScopeCheck referenceScopeCheck) {
        this.fieldName = fieldName;
        this.dataType = dataType;
        this.referenceScopeCheck = referenceScopeCheck;
    }

    public int getBeginIndex() {
        return fieldName.getEndIndex();
    }

    public int getEndIndex() {
        if (referenceScopeCheck != null) {
            return referenceScopeCheck.getEndIndex();
        }
        return dataType.getEndIndex();
    }

    public Identifier getFieldName() {
        return fieldName;
    }

    public DataType getDataType() {
        return dataType;
    }

    public ReferenceScopeCheck getReferenceScopeCheck() {
        return referenceScopeCheck;
    }

}
